<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>用户信息修改</title>
	<!-- 公共样式 开始 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/base.css">
	<link rel="stylesheet" type="text/css" href="Resources/css/iconfont.css">
	<script type="text/javascript" src="Resources/framework/jquery-1.11.3.min.js"></script>
	<link rel="stylesheet" type="text/css" href="Resources/layui/css/layui.css">
	<script type="text/javascript" src="Resources/layui/layui.js"></script>
	<!-- 滚动条插件 -->
	<link rel="stylesheet" type="text/css" href="Resources/css/jquery.mCustomScrollbar.css">
	<script src="Resources/framework/jquery-ui-1.10.4.min.js"></script>
	<script src="Resources/framework/jquery.mousewheel.min.js"></script>
	<script src="Resources/framework/jquery.mCustomScrollbar.min.js"></script>	
	<script type="text/javascript" src="Resources/js/check.js"></script>
	<style>
			.layui-form-label{
				width: 100px;
			}
			.layui-input-block{
				margin-left: 130px;
			}
		</style>
	<base target="_parent" />
</head>
<body>
 	<div class="cBody">
			<form method="post" id="addForm" class="layui-form" action="listUser?status=update&uid=${user.uid}">
				<div class="layui-form-item">
					<label class="layui-form-label">用户ID</label>
					<div class="layui-input-block">
						<a class="layui-input" style="">${user.uid}</a>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">权限选择</label>
	                <div class="layui-input-inline">
	                    <select name="role" id="role" lay-filter="role">
	                        <c:if test="${user.role.rid=='1' }">
	                        	<option value="2">普通用户</option>
					        	<option value="1" selected="selected">管理员</option>
	                        </c:if>
					        <c:if test="${user.role.rid=='2' }">
	                        	<option value="2" selected="selected">普通用户</option>
					        	<option value="1">管理员</option>
	                        </c:if>
	                    </select>
	                </div>
                </div>
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-block">
						<input type="text" name="userName" autocomplete="off" class="layui-input" value="${user.uname}" readonly="readonly">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">密码</label>
					<div class="layui-input-block">
						<input type="text" name="pwd" autocomplete="off" class="layui-input" value="${user.pwd }">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">性别选择</label>
	                <div class="layui-input-inline">
	                    <select name="sex" id="role" lay-filter="role">
	                   		<c:if test="${user.sex == '男'}" >
	                    		<option  value="男" selected="selected">男</option>
	                    		<option value="女">女</option>
	                    	</c:if>
	                        <c:if test="${user.sex == '女'}" >
	                    		<option value="女" selected="selected">女</option>
	                    		<option  value="男" >男</option>
	                    	</c:if>
	                    </select>
	                </div>
                </div>
                <div class="layui-form-item">
					<label class="layui-form-label">邮箱</label>
					<div class="layui-input-block">
						<input type="text" name="email" autocomplete="off" class="layui-input" value="${user.email }">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">真实姓名</label>
					<div class="layui-input-block">
						<input type="text" name="relname" required lay-verify="required|text" autocomplete="off" class="layui-input" value="${user.relName}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">地址</label>
					<div class="layui-input-block">
						<input type="text" name="address" required lay-verify="required|text" autocomplete="off" class="layui-input" value="${user.address}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">电话</label>
					<div class="layui-input-block">
						<input type="text" name="utel" required lay-verify="required|number" autocomplete="off" class="layui-input" value="${user.telephone}">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">余额</label>
					<div class="layui-input-block">
						<input type="text" name="balance" required lay-verify="required|number" autocomplete="off" class="layui-input" value="${user.balance}">
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="submitBut" >立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
			
			
			<script>
			
				layui.use(['upload','form'], function() {
					var form = layui.form;
					var upload = layui.upload;
					var layer = layui.layer;
					//监听提交
					//解决了layui.open弹窗从内部关闭这个弹窗的问题
					form.on('submit(submitBut)', function(data) {
						var updateFrame = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
						parent.layer.close(updateFrame);  //再改变当前层的标题
					});
					form.verify({
						//数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
					  	ZHCheck: [
						    /^[\u0391-\uFFE5]+$/
						    ,'只允许输入中文'
					  	] 
					});
				});
			</script>
		</div>
</body>
</html>